home *** CD-ROM | disk | FTP | other *** search
- #include "6502.h"
- #include "global.h"
- #include "stack.h"
-
- // Note the stack lives from 0x01FF - 0x0100
-
- //////////////////////////////////////////////
- //
- // PushByte Push Byte on Stack
- //
- //////////////////////////////////////////////
- void PushByte(UInt8 theByte)
- {
- gStack[sp--] = theByte;
- }
-
- //////////////////////////////////////////////
- //
- // PushWord Push 2 Bytes on Stack
- //
- //
- //////////////////////////////////////////////
- void PushWord(UInt16 theWord)
- {
- PushByte(theWord & 0xFF);
- PushByte(theWord >> 8);
- }
-
- //////////////////////////////////////////////
- //
- // PopByte Pop Byte from Stack
- //
- //////////////////////////////////////////////
- UInt8 PopByte(void)
- {
- return gStack[++sp];
- }
-
- //////////////////////////////////////////////
- //
- // PopWord Pop Word from Stack
- //
- //////////////////////////////////////////////
- UInt16 PopWord(void)
- {
- UInt16 theWord = (((UInt16)(gStack[++sp])) << 8);
- theWord |= gStack[++sp];
- return theWord;
- }
-